package csel.controller.commands;

import csel.model.*;
import csel.view.*;

public class EquipCommand implements GameCommand
{
	private TakeableItem[] items;
	private Entity entity;

	//creates an instance of the Equip command
	public EquipCommand(Model model, StatusViewport statusViewport)
	{
		this.entity = model.getPlayerEntity();
		this.items = statusViewport.getSelectedInventoryItems();
	}

	// Iterates over the items and equips them
	public void execute()
	{
		if (items != null)
		{
			for (TakeableItem i : items)
			{
				entity.setEquippedItem((EquippableItem) i);
			}
		}
		if(Model.infoMode)System.out.println("[MODEL] the Equip command has been called");
	}
	
	public String toString()
	{
		return this.getClass().getSimpleName();
	}

}